package main

import "fmt"

type Mover interface {
	Move()
}

type Dog struct {
	Name string
}

func (dog *Dog) Move() {

}

type Cat struct {
}

func (cat *Cat) Move() {

}

func main() {

	var n Mover = &Dog{Name: "旺财"}
	v, ok := n.(*Dog)
	if ok {
		fmt.Println("类型断言成功")
		v.Name = "富贵" // 变量v是*Dog类型
	} else {
		fmt.Println("类型断言失败")
	}

}
